<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <title>修改密码</title>
    <link rel="stylesheet" href="css/base.css" />
    <link rel="stylesheet" href="css/iconfont.css" />
    <link rel="stylesheet" href="css/change-password.css" />
    <link rel="stylesheet" href="css/all.css" />
</head>
<body>
<div>
    <div class="head">
        <span href="javascript:;" onclick="go()">
        <i class="iconfont icon-iconfontjiantou1"></i></span>
        <h1 class="titles">修改密码</h1>
    </div>
    <div class="middle">
        <form action="">
            <div class="resetUpwd">
                <input type="text" placeholder="请输入原始密码" class="resetUpwd-input" id="changeYpassword"/>
            </div>
            <div class="resetUpwd">
                <input type="password" placeholder="请输入新密码" class="resetUpwd-input" id="changeXpassword"/>
            </div>
            <div class="resetUpwd">
                <input type="password" placeholder="请输入确认密码" class="resetUpwd-input" id="changeConfirm"/>
            </div>
            <!--<div class="submits"></div>-->
            <button type="button" class="submits" >
                                 确定
            </button>
        </form>
    </div>
</div>
</body>
<script src="js/jquery.js"></script>
<script src="js/x_rem.js"></script>
<script src="js/all.js"></script>
<script>
	$(".submits").click(()=>{
		if(!vali($("#changeYpassword"),/^[a-zA-Z0-9_]{6}$/,"原密码请输入6位字母或数字")){
			
		}else if(!vali($("#changeXpassword"),/^[a-zA-Z0-9_]{6}$/,"新密码请输入6位字母或数字")){
			
		}else if($("#changeConfirm").val() != $("#changeXpassword").val()){
			popup("两次密码不一致");
		
		}else {
			//ajax要传入的数据
			var data={
				password : $("#changeYpassword").val(),
				newPassword : $("#changeXpassword").val()
			};
			
			//成功后执行的函数
			
			var success=(data)=>{
				popup(data.message);
				
				
			};
			
			//调用AJAX
			
			Hajax("post","/user/updatePassword",data,success);
			
		}
		
		
		
		
		
	})
	
	
</script>
</html>